Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter for ldap related tests #14540

Merged

Conversation

dosas
Copy link
Collaborator

@dosas dosas commented Mar 27, 2024

No description provided.

@dosas dosas requested review from a team as code owners March 27, 2024 13:17
Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems pretty similiar to 0397a0d so I'm fine with it.

Copy link
Member

@jyejare jyejare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK pending suggestion.

@@ -25,6 +25,7 @@ def pytest_configure(config):
"include_capsule: For satellite-maintain tests to run on Satellite and Capsule both",
"capsule_only: For satellite-maintain tests to run only on Capsules",
"manifester: Tests that require manifester",
"ldap: Tests related to ldap authentication",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dosas , I think we are going too deep with adding markers to filter tests by adding explicit markers.

BTW we have similar implementation in robottelo that adds marker on each test based on component doc tag implemented here https://github.com/SatelliteQE/robottelo/blob/master/pytest_plugins/metadata_markers.py#L109

With this you should be able to opt in / opt out tests based on component name including ldap. If this suits your need, please close the PR.

Copy link
Collaborator Author

@dosas dosas Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly this does not fit my needs.

The tests I want to filter are the ones using create_ldap fixture

pytest --co -q -m "ldap" tests/foreman/api
tests/foreman/api/test_role.py::TestCannedRole::test_negative_access_entities_from_ldap_org_admin
tests/foreman/api/test_role.py::TestCannedRole::test_negative_access_entities_from_ldap_user
tests/foreman/api/test_role.py::TestCannedRole::test_positive_assign_org_admin_to_ldap_user_group
tests/foreman/api/test_role.py::TestCannedRole::test_negative_assign_org_admin_to_ldap_user_group
tests/foreman/api/test_user.py::TestActiveDirectoryUser::test_positive_create_in_ldap_mode[0]
tests/foreman/api/test_user.py::TestActiveDirectoryUser::test_positive_create_in_ldap_mode[1]
tests/foreman/api/test_user.py::TestActiveDirectoryUser::test_positive_create_in_ldap_mode[2]
tests/foreman/api/test_user.py::TestActiveDirectoryUser::test_positive_create_in_ldap_mode[3]
tests/foreman/api/test_user.py::TestActiveDirectoryUser::test_positive_create_in_ldap_mode[4]
tests/foreman/api/test_user.py::TestActiveDirectoryUser::test_positive_ad_basic_no_roles
tests/foreman/api/test_user.py::TestActiveDirectoryUser::test_positive_access_entities_from_ldap_org_admin
tests/foreman/api/test_user.py::TestFreeIPAUser::test_positive_ipa_basic_no_roles
tests/foreman/api/test_user.py::TestFreeIPAUser::test_positive_access_entities_from_ipa_org_admin

I also tried filtering by -k expression but this does not yield the right result

pytest --co -q --component=ldap tests/foreman/api
no tests collected

I doubt that I can change the component for https://github.com/SatelliteQE/robottelo/blob/master/tests/foreman/api/test_role.py#L1627 to ldap

I also have not found a way to not run tests belonging to a certain component, is this even possible?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dosas No ! You cant change the component names because they are tightly coupled with our internal component mappings system.

To filter out the component tests , you can use -m not <component_name>.

Copy link
Collaborator Author

@dosas dosas Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dosas No ! You cant change the component names because they are tightly coupled with our internal component mappings system.

That is what I thought ;)

To filter out the component tests , you can use -m not <component_name>.

No, this does not work:

pytest --co -q -m "not AlternateContentSources" tests/foreman/api
2724/2806 tests collected (82 deselected)

pytest --co -q  tests/foreman/api
2724/2806 tests collected (82 deselected)
pytest --co -q --component=AlternateContentSources tests/foreman/api
7/2806 tests collected (2799 deselected)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh ! These component names as markers are applied as key=value pair styled and hence we cant filter them out from -m option. We can change that in future though or hope pytest supports that.

So for now I am ACKing you.

@dosas
Copy link
Collaborator Author

dosas commented Mar 28, 2024

I cannot add tags. Can someone else add them?

Is there a possibility to enable members of SatelliteQE to add tags?

@jyejare jyejare added CherryPick PR needs CherryPick to previous branches 6.12.z Introduced in or relating directly to Satellite 6.12 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 labels Apr 1, 2024
@Gauravtalreja1 Gauravtalreja1 merged commit 21580fc into SatelliteQE:master Apr 9, 2024
10 of 11 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 9, 2024
github-actions bot pushed a commit that referenced this pull request Apr 9, 2024
github-actions bot pushed a commit that referenced this pull request Apr 9, 2024
github-actions bot pushed a commit that referenced this pull request Apr 9, 2024
Gauravtalreja1 pushed a commit that referenced this pull request Apr 9, 2024
Add filter for ldap related tests (#14540)

(cherry picked from commit 21580fc)

Co-authored-by: dosas <[email protected]>
Gauravtalreja1 pushed a commit that referenced this pull request Apr 9, 2024
Add filter for ldap related tests (#14540)

(cherry picked from commit 21580fc)

Co-authored-by: dosas <[email protected]>
Gauravtalreja1 pushed a commit that referenced this pull request Apr 9, 2024
Add filter for ldap related tests (#14540)

(cherry picked from commit 21580fc)

Co-authored-by: dosas <[email protected]>
Gauravtalreja1 pushed a commit that referenced this pull request Apr 9, 2024
Add filter for ldap related tests (#14540)

(cherry picked from commit 21580fc)

Co-authored-by: dosas <[email protected]>
shweta83 pushed a commit to shweta83/robottelo that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.12.z Introduced in or relating directly to Satellite 6.12 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 CherryPick PR needs CherryPick to previous branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants